<%@ Control Language="c#" AutoEventWireup="false" Codebehind="QueryBuilder.ascx.cs" Inherits="SplendidCRM.Reports.QueryBuilder" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="SplendidCRM" Tagname="DatePicker" Src="~/_controls/DatePicker.ascx" %>
<script runat="server">
/**********************************************************************************************************************
 * SplendidCRM is a Customer Relationship Management program created by SplendidCRM Software, Inc. 
 * Copyright (C) 2005-2011 SplendidCRM Software, Inc. All rights reserved.
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the 
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3 
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this program. 
 * If not, see <http://www.gnu.org/licenses/>. 
 * 
 * You can contact SplendidCRM Software, Inc. at email address support@splendidcrm.com. 
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3, 
 * the Appropriate Legal Notices must display the following words on all interactive user interfaces: 
 * "Copyright (C) 2005-2011 SplendidCRM Software, Inc. All rights reserved."
 *********************************************************************************************************************/

	</script>
<div id="divEditView">
	<asp:Label ID="lblError" CssClass="error" EnableViewState="false" Runat="server" />

	<asp:Table SkinID="tabForm" runat="server">
		<asp:TableRow>
			<asp:TableCell>
				<asp:Table BorderWidth="0" CellSpacing="0" CellPadding="0" runat="server">
					<asp:TableRow ID="trModule">
						<asp:TableCell Width="15%" CssClass="dataLabel"><asp:Label Text='<%# L10n.Term("Reports.LBL_MODULE_NAME") %>' runat="server" /></asp:TableCell>
						<asp:TableCell Width="35%" CssClass="dataField">
							<asp:DropDownList ID="lstMODULE" TabIndex="1" DataValueField="MODULE_NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstMODULE_Changed" AutoPostBack="true" Runat="server" />
							<asp:Label ID="lblMODULE" runat="server" />
						</asp:TableCell>
					</asp:TableRow>
					<asp:TableRow ID="trRelated" Visible="false" runat="server">
						<asp:TableCell Width="15%" CssClass="dataLabel"><asp:Label Text='<%# L10n.Term("Reports.LBL_RELATED") %>' runat="server" /></asp:TableCell>
						<asp:TableCell Width="35%" CssClass="dataField">
							<asp:DropDownList ID="lstRELATED" TabIndex="3" DataValueField="MODULE_NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstRELATED_Changed" AutoPostBack="true" Runat="server" /><br />
							<asp:Label ID="lblRELATED" runat="server" />
						</asp:TableCell>
					</asp:TableRow>
					<asp:TableRow ID="trColumnSource" Visible="false" runat="server">
						<asp:TableCell Width="15%" CssClass="dataLabel"><asp:Label Text='<%# L10n.Term("Reports.LBL_MODULE_NAME") %>' runat="server" /></asp:TableCell>
						<asp:TableCell Width="35%" CssClass="dataField">
							<asp:DropDownList ID="lstMODULE_COLUMN_SOURCE" TabIndex="1" DataValueField="MODULE_NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstMODULE_COLUMN_SOURCE_Changed" AutoPostBack="true" Runat="server" /><br />
							<asp:Label ID="lblMODULE_COLUMN_SOURCE" runat="server" />
						</asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableCell Width="15%" CssClass="dataLabel"><asp:Label Text='<%# L10n.Term("Reports.LBL_FILTERS") %>' runat="server" /></asp:TableCell>
						<asp:TableCell Width="35%" CssClass="dataField">
							<asp:Button ID="btnAddFilter" CommandName="Filters.Add" OnCommand="Page_Command" CssClass="button" Text='<%# L10n.Term("Reports.LBL_ADD_FILTER_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term("Reports.LBL_ADD_FILTER_BUTTON_LABEL") %>' Runat="server" />
						</asp:TableCell>
						<asp:TableCell Width="15%" CssClass="dataLabel"><asp:Label Text='<%# L10n.Term("Reports.LBL_SHOW_QUERY") %>' runat="server" /></asp:TableCell>
						<asp:TableCell Width="35%" CssClass="dataField"><asp:CheckBox ID="chkSHOW_QUERY" CssClass="checkbox" AutoPostBack="true" runat="server" /></asp:TableCell>
					</asp:TableRow>
				</asp:Table>
			</asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell style="padding-top: 5px; padding-bottom: 5px;">
				<asp:DataGrid ID="dgFilters" AutoGenerateColumns="false" CellPadding="3" CellSpacing="0" 
					AllowPaging="false" AllowSorting="false" ShowHeader="true" EnableViewState="true" runat="server">
					<Columns>
						<asp:BoundColumn HeaderText="Module"   DataField="MODULE_NAME" />
						<asp:BoundColumn HeaderText="Field"    DataField="DATA_FIELD"  />
						<asp:BoundColumn HeaderText="Type"     DataField="DATA_TYPE"   />
						<asp:BoundColumn HeaderText="Operator" DataField="OPERATOR"    />
						<asp:BoundColumn HeaderText="Search"   DataField="SEARCH_TEXT" />
						<asp:TemplateColumn HeaderText="" ItemStyle-Width="1%" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="false">
							<ItemTemplate>
								<asp:Button ID="btnEditFilter" CommandName="Filters.Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>' OnCommand="Page_Command" CssClass="button" Text='<%# L10n.Term(".LBL_EDIT_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term(".LBL_EDIT_BUTTON_TITLE") %>' Runat="server" />
								&nbsp;
								<asp:Button ID="btnDeleteFilter" CommandName="Filters.Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>' OnCommand="Page_Command" CssClass="button" Text='<%# L10n.Term("Reports.LBL_REMOVE_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term("Reports.LBL_REMOVE_BUTTON_TITLE") %>' Runat="server" />
							</ItemTemplate>
						</asp:TemplateColumn>
					</Columns>
				</asp:DataGrid>
			</asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell>
				<input id="txtFILTER_ID" type="hidden" runat="server" />
				<asp:Table SkinID="tabEditView" runat="server">
					<asp:TableRow>
						<asp:TableCell VerticalAlign="top">
							<asp:DropDownList ID="lstFILTER_COLUMN_SOURCE" TabIndex="10" DataValueField="MODULE_NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstFILTER_COLUMN_SOURCE_Changed" AutoPostBack="true" Runat="server" /><br />
							<asp:Label ID="lblFILTER_COLUMN_SOURCE" runat="server" />
						</asp:TableCell>
						<asp:TableCell VerticalAlign="top">
							<asp:DropDownList ID="lstFILTER_COLUMN" TabIndex="11" DataValueField="NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstFILTER_COLUMN_Changed" AutoPostBack="true" Runat="server" /><br />
							<asp:Label ID="lblFILTER_COLUMN" runat="server" />
						</asp:TableCell>
						<asp:TableCell VerticalAlign="top">
							<asp:DropDownList ID="lstFILTER_OPERATOR" TabIndex="12" DataValueField="NAME" DataTextField="DISPLAY_NAME" OnSelectedIndexChanged="lstFILTER_OPERATOR_Changed" AutoPostBack="true" Runat="server" /><br />
							<asp:Label ID="lblFILTER_OPERATOR_TYPE" runat="server" /><asp:Image SkinID="Spacer" Width="4" runat="server" />
							<asp:Label ID="lblFILTER_OPERATOR" runat="server" />
						</asp:TableCell>
						<asp:TableCell VerticalAlign="top" Wrap="false">
							<asp:Table BorderWidth="0" CellSpacing="0" CellPadding="0" runat="server">
								<asp:TableRow>
									<asp:TableCell>
										<input type="hidden" id="txtFILTER_SEARCH_ID" runat="server" />
										<input type="hidden" id="txtFILTER_SEARCH_DATA_TYPE" runat="server" />
										
										<asp:TextBox ID="txtFILTER_SEARCH_TEXT"   runat="server" />
										
										<asp:DropDownList ID="lstFILTER_SEARCH_DROPDOWN" DataValueField="NAME" DataTextField="DISPLAY_NAME" runat="server" />
										<asp:ListBox      ID="lstFILTER_SEARCH_LISTBOX"  DataValueField="NAME" DataTextField="DISPLAY_NAME" SelectionMode="Multiple" runat="server" />
										
										<SplendidCRM:DatePicker ID="ctlFILTER_SEARCH_START_DATE" EnableDateFormat="false" Runat="Server" />
									</asp:TableCell>
									<asp:TableCell>
										<asp:Label ID="lblFILTER_AND_SEPARATOR" Text='<%# L10n.Term("Schedulers.LBL_AND") %>' runat="server" />
									</asp:TableCell>
									<asp:TableCell>
										<SplendidCRM:DatePicker ID="ctlFILTER_SEARCH_END_DATE" EnableDateFormat="false" Runat="Server" />
										
										<asp:TextBox ID="txtFILTER_SEARCH_TEXT2"  runat="server" />
										
										<asp:Button ID="btnFILTER_SEARCH_SELECT" Visible="false" OnClientClick="SearchPopup(); return false;" CssClass="button" Text='<%# L10n.Term(".LBL_SELECT_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term(".LBL_SELECT_BUTTON_TITLE") %>' runat="server" />
									</asp:TableCell>
								</asp:TableRow>
							</asp:Table>
							<asp:Label ID="lblFILTER_ID" runat="server" />
						</asp:TableCell>
						<asp:TableCell VerticalAlign="top">
							<asp:Button CommandName="Filters.Update" OnCommand="Page_Command" CssClass="button" Text='<%# L10n.Term(".LBL_UPDATE_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term(".LBL_UPDATE_BUTTON_TITLE") %>' Runat="server" />
						</asp:TableCell>
						<asp:TableCell VerticalAlign="top">
							<asp:Button CommandName="Filters.Cancel" OnCommand="Page_Command" CssClass="button" Text='<%# L10n.Term(".LBL_CANCEL_BUTTON_LABEL") %>' ToolTip='<%# L10n.Term(".LBL_CANCEL_BUTTON_TITLE") %>' Runat="server" />
						</asp:TableCell>
						<asp:TableCell Width="80%"></asp:TableCell>
					</asp:TableRow>
				</asp:Table>
			</asp:TableCell>
		</asp:TableRow>
	</asp:Table>

	<asp:Literal ID="litREPORT_QUERY" EnableViewState="false" runat="server" />
	<asp:Literal ID="litREPORT_RDL" EnableViewState="false" runat="server" />
</div>



